home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 43 / Mac Magazin and MacEasy Magazine CD - Issue 43.iso / Software / Mobiles Büro / Newton / Newton Entwickler / DIL 2.0 Sample Code ƒ / SoupDrink-Mac-4 / HLFDIL.H < prev    next >
Text File  |  1995-12-21  |  7KB  |  173 lines

  1. /*
  2.     File:        HLFDIL.h
  3.  
  4.     Contains:    Definitions of the DIL Object class.
  5.                 This includes the DIL variable-to-object binding definitions
  6.  
  7.  Note:
  8.              The Symantec for MPW compiler currently treats shorts differently than the MPW CFront compiler.
  9.           Other compilers may also use this calling convention.  This only applies to using the MPW version of
  10.           the libraries.
  11.           
  12.           To use this type of environment, please define USE_SIXTEEN_BIT_SHORTS before including this file.
  13.  
  14.     Written by:    Rob Langhorne
  15.  
  16.       Copyright c 1995 Apple Computer, Inc.
  17.       All rights reserved.
  18.  
  19.     Change History (most recent first):  
  20.             version 1.0 Universal CDIL Headers
  21.  
  22. */
  23.  
  24. #ifndef __DILFDIL_H
  25. #define __DILFDIL_H
  26.  
  27. #ifndef __DILPIPE_H
  28.     #include "DILCPipe.h"
  29. #endif
  30.  
  31. #if GENERATINGPOWERPC
  32. #pragma options align=mac68k
  33. #endif
  34.  
  35. /*-------------------------------------------------------------------------
  36. **
  37. **    Definitions
  38. **
  39. ** ------------------------------------------------------------------------ */
  40.  
  41. #define objErr             long                /*    Object method error returns                                */
  42. #define unicodeFactor     2        /*    Adjustment factor for buffers in unicode conversions    */
  43.  
  44. #define TDIL_REFERENCE 8  /*  The reference used is circular                                        */
  45.  
  46. /*-------------------------------------------------------------------------
  47. **    Local Error Codes    
  48. ** ------------------------------------------------------------------------ */
  49.  
  50. #define kobjErrNoErr        0                            /*    No error                        */
  51.  
  52. #define kFDILErrBase        (-800 + -28000)                /*    FDIL Error code base number        */
  53.  
  54. #define kObjectHeapNoMemory        (-1 + kFDILErrBase)            /*    Out of heap memory                */
  55. #define kTempNoMemory                                (-2 + kFDILErrBase)            /*    Out of other memory                */
  56. #define kUnknownSlot                                    (-3 + kFDILErrBase)            /*    Slot not known                    */
  57. #define kSlotSizeExceeded                (-4 + kFDILErrBase)            /*    Slot defined size exceeded        */
  58. #define kSlotSizeRequired                (-5 + kFDILErrBase)            /*    A required slot size is missing    */
  59. #define kUnexpectedDataType     (-6 + kFDILErrBase)         /*    The data type we received was unexpected    */
  60.  
  61. /*-------------------------------------------------------------------------
  62. **    DIL Variable types
  63. ** ------------------------------------------------------------------------ */
  64. enum kDILSlotTypes {
  65.       kDILImmediate,                                /*    Indeterminate Immediate type     */
  66.       kDILCharacter,                                /*    ASCII Character                              */
  67.       kDILUnicodeCharacter,    /*    Unicode Character                         */
  68.       kDILBinaryObject,                    /*    Small Binary Object ( < 32K )    */
  69.       kDILArray,                                                /*    Named Array                                     */
  70.       kDILPlainArray,                            /*    Anonymous Array                              */
  71.       kDILFrame,                                    /*    Frame                                              */
  72.       kDILSymbol,                       /*    Object Symbol                                */
  73.       kDILString,                       /*    String (null-terminated)            */
  74.       kDILPrecedent,                 /*    Repeated Item                                */
  75.       kDILNIL,                          /*    nil object                                      */
  76.       kDILSmallRect,                 /*    Small rect                                      */
  77.       kDILBLOB,                         /*    Large Binary Object                       */
  78.       kDILBoolean,                   /*    Boolean                                            */
  79.       kDILInteger                       /*    Integer (4 byte)                          */
  80. };
  81.  
  82. // shorter definition for unsigned long
  83. typedef unsigned long ulong;
  84.  
  85. // DIL Object
  86. typedef void FAR DILObj;
  87.  
  88. /*-------------------------------------------------------------------------
  89. **    DIL Object slot type    
  90. ** ------------------------------------------------------------------------ */
  91.  
  92. typedef struct    slotDefinition
  93. {
  94.     short        varType   ;        /*    Data type of this variable                 */
  95.     void         *var         ;        /*    Actual variable pointer                       */
  96.     ulong        length       ;        /*    Length of this variable (strings)    */
  97.     ulong        maxLength ;        /*    Maximum Length of this variable         */
  98.     ulong        streamLen ;        /*    Length of streaming this slot           */    /* Internal    */
  99.     ulong        bufIndex  ;        /*    Current buffer index                          */    /* Internal    */
  100.     long         namePrec  ;        /*    Is this the original precedent          */    /* Internal    */
  101.     long         classPrec ;        /*    Is this the original precedent          */    /* Internal    */
  102.     char         *slotName ;        /*    Name of slot for this bind var          */
  103.     char         *oClass      ;        /*    class of this compound object           */
  104.     short        slotType  ;        /*    Data type of this slot                        */        
  105.     ulong        truncSize ;        /*    Current size of truncated object     */
  106.     long         childCnt  ;        /*    Number of child nodes                         */
  107.     long         peerCnt      ;        /*    Number of peer nodes                          */
  108.     short     dataFilled;        /*    Set to TRUE if data has been added in this
  109.                                     slot in this operation                                       */
  110.     long        internalFlags;    /*    Internal state flags                         */
  111.     short     boundData ;      /* for future use                   */
  112.     struct    slotDefinition    *children ;
  113.     struct    slotDefinition    *next ;
  114. }    slotDefinition ;
  115.  
  116. /*-------------------------------------------------------------------------
  117. **        DILObject Class
  118. ** ------------------------------------------------------------------------ */
  119. #ifdef __cplusplus
  120. extern "C" {
  121.         /*    object maintenance    */
  122.   #ifdef USE_SIXTEEN_BIT_SHORTS
  123.              objErr     FDbindSlot        ( DILObj *DILobj, char *slotName, void   *bindVar, long varType, long maxLen, long curLen = -1, char *objClass = nil ) ;
  124.      #else
  125.              objErr     FDbindSlot        ( DILObj *DILobj, char *slotName, void   *bindVar, short varType, long maxLen, long curLen = -1, char *objClass = nil ) ;
  126.      #endif  /* USE_SIXTEEN_BIT_SHORTS    */
  127. #else
  128.   #ifdef USE_SIXTEEN_BIT_SHORTS
  129.           objErr     FDbindSlot        ( DILObj *DILobj, char *slotName, void   *bindVar, long varType, long maxLen, long curLen, char *objClass ) ;
  130.   #else
  131.           objErr     FDbindSlot        ( DILObj *DILobj, char *slotName, void   *bindVar, short varType, long maxLen, long curLen, char *objClass ) ;
  132.         #endif  /* USE_SIXTEEN_BIT_SHORTS    */
  133. #endif
  134.  
  135.         /*    ~~~~~ object communications    */
  136. #ifdef USE_SIXTEEN_BIT_SHORTS
  137.         objErr    FDput     ( DILObj *DILobj, long objectType, CDILPipe *pipe );
  138.         objErr FDget  ( DILObj *DILobj, long objectType, CDILPipe *pipe, long timeOut, CDILPipeCompletionProcPtr completionHook,long refCon);
  139. #else
  140.         objErr    FDput     ( DILObj *DILobj, short objectType, CDILPipe *pipe );
  141.         objErr FDget  ( DILObj *DILobj, short objectType, CDILPipe *pipe, long timeOut, CDILPipeCompletionProcPtr completionHook,long refCon);
  142. #endif /* USE_SIXTEEN_BIT_SHORTS    */
  143.  
  144.         /*    ~~~~~ unbound list operations    */
  145.         slotDefinition *        FDGetUnboundList    ( DILObj *DILobj ) ;
  146.         objErr                                 FDFreeUnboundList    ( DILObj *DILobj, slotDefinition *desc ) ;
  147.         
  148.         
  149. #ifdef __cplusplus
  150. }     /* DILObject    */
  151. #endif
  152.  
  153. /*-------------------------------------------------------------------------
  154. **        Basic functions
  155. ** ------------------------------------------------------------------------ */
  156. #ifdef __cplusplus
  157. extern "C" {
  158. #endif
  159.    objErr        FDInitFDIL                                 ( void );
  160.    objErr     FDDisposeFDIL                     ( void ) ;
  161. #ifdef USE_SIXTEEN_BIT_SHORTS
  162.    DILObj  *FDCreateObject       ( long objectType, char *objectClass ) ;
  163. #else
  164.    DILObj  *FDCreateObject       ( short objectType, char *objectClass ) ;
  165. #endif /* USE_SIXTEEN_BIT_SHORTS    */
  166.  
  167.    objErr        FDDisposeObject             ( DILObj *DILobj )    ;
  168. #ifdef __cplusplus
  169. }
  170. #endif
  171.  
  172. #endif    /* __DILFDIL_H */
  173.